package com.shujia.hdfs;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;

import java.io.IOException;

public class Demo03Mkdir {

    public static void main(String[] args) throws IOException {

        Configuration conf = new Configuration();
        conf.set("fs.defaultFS", "hdfs://master:9000");
        FileSystem fs = FileSystem.get(conf);

        // mkdir 创建目录:默认会进行递归的创建，即父目录不存在会自动创建
        fs.mkdirs(new Path("/user/root/d3"));
        fs.mkdirs(new Path("/user/root/d4/dd4"));
    }
}
